package com.smxy.mall.dao;

import com.smxy.mall.entity.Car;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

public interface CarDao extends JpaRepository<Car,String>, JpaSpecificationExecutor<Car> ,CarDaoExt{
    Car save(Car car);
    @Transactional
    Integer deleteById(Integer id);
    @Transactional
    Integer deleteAllByUserIdAndShopId(Integer userId,Integer shopId);
    /**
     *
     * @param goodsId
     * @param userId
     * @param shopId
     * @return
     */
    Car findByGoodsIdAndUserIdAndShopId(Integer goodsId,Integer userId,Integer shopId);
    Car findById(Integer id);
    List<Car> findByUserId(Integer userId);
    List<Car> findByUserIdAndShopId(Integer userId,Integer shopId);
}
